package callback;

import client.Client;
import util.Utils;
import view.LobbyView;

public class LobbyBackBtnCallback extends ClientCallback{

	private LobbyView mLobbyView;
	public LobbyBackBtnCallback(Client client, LobbyView lobbyView) {
		super(client);
		
		this.mLobbyView = lobbyView;
	}
	
	@Override
	public void perform() {
		if(Utils.getLeagueId() != -1) { // In Room League view 
			mMainScreen.showLobbyView(false);
			if(mMainScreen.getmLobbyView() != null)
				mMainScreen.getmLobbyView().showLeague();
			Utils.saveLeagueId(-1);
		} else if(Utils.isLeagueMode()){ // In the League view
			mLobbyView.showRoom();
			Utils.leaveLeagueMode();
		}
		else {
			mMainScreen.showHomePageView();
		}
		System.out.println("Current League Id: " + Utils.getLeagueId());
	}

}
